<!DOCTYPE html>
<html lang="en">
<!-- 页面meta -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>传智健康</title>
<meta name="description" content="传智健康">
<meta name="keywords" content="传智健康">
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
<!-- 引入样式 -->
<!-- 引入样式 -->
<link rel="stylesheet" href="../plugins/elementui/index.css">
<link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="../css/style.css">
<!-- 引入组件库 -->
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script src="../js/vue.js"></script>
<script src="../plugins/elementui/index.js"></script>
<script src="../js/axios-0.18.0.js"></script>
<style>
    .avatar-uploader .el-upload {
        border: 1px dashed #d9d9d9;
        border-radius: 6px;
        cursor: pointer;
        position: relative;
        overflow: hidden;
    }

    .avatar-uploader .el-upload:hover {
        border-color: #409EFF;
    }

    .avatar-uploader-icon {
        font-size: 28px;
        color: #8c939d;
        width: 178px;
        height: 178px;
        line-height: 178px;
        text-align: center;
    }

    .avatar {
        width: 178px;
        height: 178px;
        display: block;
    }

    .datatable {
        position: relative;
        box-sizing: border-box;
        -webkit-box-flex: 1;
        width: 100%;
        max-width: 100%;
        font-size: 14px;
        color: rgb(96, 98, 102);
        overflow: hidden;
        flex: 1 1 0%;
    }

    .datatable td, .datatable th {
        padding: 12px 0;
        min-width: 0;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
        text-overflow: ellipsis;
        vertical-align: middle;
        position: relative;
        text-align: left;
    }
</style>
<body>
<div id="div">

    <el-container>
        <el-header>
            <div class="content-header">
                <h1>系统设置
                    <small>菜单管理</small>
                </h1>
                <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>系统设置</el-breadcrumb-item>
                    <el-breadcrumb-item>菜单管理</el-breadcrumb-item>
                </el-breadcrumb>


            </div>

        </el-header>

        <el-container>

            <el-container>
                <div class="filter-container">
                    &nbsp; &nbsp; &nbsp;
                    <el-input placeholder="菜单名称" v-model="pagination.queryString" style="width: 200px;"
                              class="filter-item"></el-input>
                    <el-button @click="findPage()" class="dalfBut">查询</el-button>
                    <el-button type="primary" class="butT" @click="handleCreate()">新建</el-button>
                </div>

                <el-main>



                    <el-table :data="menuData" style="width: 100%" >
                        <el-table-column prop="fMenu" label="父菜单" width="180" align="center"></el-table-column>
                       <el-table-column prop="cMenus" label="子菜单" align="center" >

                            <template slot-scope="{row,}">
                                <span v-for="(item,index) in row.cMenus"
                                      :key="index">
                                      {{item.cMenuName}}
                                    <br/>
                                  </span>
                            </template>

                        </el-table-column>

                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">权限管理</el-button>
                            </template>
                        </el-table-column>
                    </el-table>

                    <div class="pagination-container">
                        <el-pagination
                                class="pagiantion"
                                @current-change="handleCurrentChange"
                                :current-page="pagination.currentPage"
                                :page-size="pagination.pageSize"
                                layout="total, prev, pager, next, jumper"
                                :total="pagination.total">
                        </el-pagination>
                    </div>

                </el-main>

                <el-footer>

                </el-footer>
            </el-container>

        </el-container>
    </el-container>

</div>
<script>
    new Vue({
        el:"#div",
        data:{

            pagination: {//分页相关模型数据
                currentPage: 1,//当前页码
                pageSize: 5,//每页显示的记录数
                total: 0,//总记录数
                queryString: null//查询条件

            },

            menuData:[],

        },

        methods:{


            findPage(){
                let param = {
                    currentPage: this.pagination.currentPage,
                    pageSize: this.pagination.pageSize,
                    queryString: this.pagination.queryString
                };
                axios.post("/menu/findPage.do", param)
                    .then(data => {
                        this.menuData = data.data.rows;
                        this.pagination.total = data.data.total
                    })
            },


            //切换页码
            handleCurrentChange(currentPage) {
                this.pagination.currentPage = currentPage;
            },
            handleUpdate(row){
                alert(row.fMenu)
            },

            handleCreate(){
                alert('aa')
            }

        },

        created(){
            this.findPage();
        }






    })
</script>
</body>
</html>